<template>
  <div class="container">代码片段</div>
</template>
<script setup>
  // logg 打印
  let logg = {
	"Print to console": {
		"prefix": "logg",
		"body": [
			"console.log('测试数据打印',$0);",
		],
		"description": "logg output to console"
	}
}
  // vue3 
  let vue3 = {
    "Print to console": {
      "prefix": "vue3",
      "body": [
        "<template>",
        "  <div class=\"container\"></div>",
        "</template>",
        "<script setup>",
        "import { ref, watch, computed, onMounted, provide, inject } from 'vue'",
        "const props = defineProps([''])",
        "const emit = defineEmits([''])",
        " $0",
        "// 向外暴露属性和方法",
        "defineExpose({",
        "",
        "})",
        "</script>",
        "<style scoped lang=\"scss\">",
        "</style>",
        " "
      ],
      "description": "A vue file template"
    }
  }
// pinia 
let pinia = {
	"Pinia Store": {
		"prefix": "pinia",
		"body": [
			"import { defineStore } from 'pinia'",
			"import { storeToRefs } from 'pinia' // 使用的时候要方法包裹,避免失去响应",
			"import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'",
			"const use${1:StoreName}Store = defineStore('${1/(.*)/${1:/downcase}/}', {",
			"  state: () => ({",
			"    $2",
			"  }),",
			"  getters: {",
			"    $3",
			"  },",
			"  actions: {",
			"    $4",
			"  },",
			"})",
			"use${1:StoreName}Store.use(piniaPluginPersistedstate)",
			"export default use${1:StoreName}Store"
		],
		"description": "Create a Pinia store"
	}
}
// watch
let watch = {
	"Print to console": {
		"prefix": "watchh",
		"body": [
			"watch([()=>$0],()=>{},{ immediate: false, deep: false }",
		],
		"description": "Log output to console"
	}
}
// vuex
  let vux = {
	"Print to console": {
		"prefix": "vuex", //此处关系到你的快捷单词
		"body": [
			"import Vue from 'vue'",
			"import Vuex from 'vuex'",
			"",
			"Vue.use(Vuex)",
			"",
			"export default new Vuex.Store({",
			" // 数据",
			"  state: {},",
			" // 修改数据",
			"  mutations: {},",
			" // 异步请求",
			"  getters: {},",
			" // 计算属性",
			"  actions: {},",
			" // 模块",
			"  modules: {}",
			"})",
			"",
		],
		"description": "Log output to console"
	}
}

// vue router
let vuer = {
	"Print to console": {
		"prefix": "vuer", //此处关系到你的快捷单词
		"body": [
			"import Vue from 'vue'",
			"import VueRouter from 'vue-router'",
			"import Home from '首页页面路径$0'",
			"",
			"Vue.use(VueRouter)",
			"",
			"const routes = [",
			" // 路由规则",
			"  {",
			"  path: '/',",
			"  name: 'home',",
			"  component: Home",
			"  },",
			"  {",
			"  path: '路由路径',",
			"  name: '',",
			"  component: () => import('页面路径')",
			"  },",
			" ] ",
			"  const router = new VueRouter({",
			"  routes",
			"  })",
			"",
			"  export default router",
			"",
		],
		"description": "Log output to console"
	}
}

// vue2 
let vue2 = {
	"Print to console": {
		"prefix": "vue2", //此处关系到你的快捷单词
		"body": [
			"<template>",
			"  <div></div>",
			"</template>",
			"",
			"<script>",
			"export default {",
			"  name: '$0',",
			"  data () {",
			"    return {",
			"    }",
			"  },",
			"",
			"  props: [],",
			" // 注册组件",
			"  components: {},",
			" // 计算属性",
			"  computed: {},",
			" // 生命周期函数",
			"  created() {},",
			" // 侦听器",
			"  watch: {",
			"data: {",
			"// 自动触发,只能使用handler",
			"handler (newVal, oldVal) {",
			"// console.log(newVal);",
			"// console.log(oldVal);",
			"},",
			"// true表示侦听器立即触发(immediate默认为false)",
			"// immediate: true,",
			"// true表示深度侦听，侦听对象属性的变化",
			"// deep: true",
			"}",
			"},",
			" // 方法函数",
			"  methods: {}",
			"}",
			"",
			"</script>",
			"<style lang='scss' scoped>",
			"</style>"
		],
		"description": "Log output to console"
	}
}
</script>
